home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
fweb
/
fweb-1.40
/
manual
/
fwebmac.web
(
.txt
)
< prev
next >
Wrap
Texinfo Document
|
1993-10-29
|
44KB
|
1,015 lines
@z --- fwebmac.web ---
Copyright (C) 1987 Princeton University
Original authors: D. Knuth, S. Levy
Upgraded by J.A. Krommes for FWEB version 1.30--beta (January 1, 1993)
@x-----------------------------------------------------------------------------
\Title{FWEBMAC}
@* INTRODUCTION. These are the standard macros for \FWEB\ (v.~1.30)
listings (in addition to those of \.{PLAIN.TEX} and/or \LaTeX).
WARNING: Some of these macros are not independent of stuff hard-coded
into \FWEAVE. In other words, if you change something here, you may also need
to recompile \FWEAVE. So caution!
@ Print a comment at the beginning of the \.{.sty} file that is created.
% --- THIS IS fwebmac.sty ---
% This file must be included into all .tex files produced by FWEAVE. For
% the source for this file, please see fwebmac.web.
% ---------------------------------------------------------------------------
@ First, we have a flag |\FWEBisloaded| that prevents \.{fwebmac.sty} from
being loaded twice. For the use of this flag, see the Dirty Tricks
appendix of the \TeX book.
% If it's not defined yet, load in the macros.
\ifx\FWEBisloaded\relax\endinput\else\let\FWEBisloaded\relax\fi
@ Various things need to know the current version number and date.
\def\FWEBversion{1.30}
\def\FWEBdate{June 10, 1993}
@ \FWEB\ now works with \LaTeX, after a fashion. Here's how to refer to it
(borrowed from \LaTeX's \.{\\p@@LaTeX} macro):
\def\LaTeX{{\rm L\kern-0.36em\raise0.3ex\hbox{\Csc a}\kern-0.15em T%
\kern-0.1667em \lower0.7ex\hbox{E}\kern-0.125em X}}
@ We need to distinguish whether or not \LaTeX\ is loaded. Assuming that
only \TeX\ or \LaTeX\ will be used, one way of doing this is to
discriminate on whether |\pageno| is defined.
\newif\ifLaTeXisloaded
\ifx\pageno\undefined
\LaTeXisloadedtrue
@ \FWEB\ now supports \LaTeX's NFSS (new font selection scheme). Macros
courtesy of Charles Karney, Princeton U.
\ifx\selectfont\undefined\else
\fontsize{10}{12pt}\rm % The standard font for bulk of document.
@ If \LaTeX\ is loaded, we equate |\pageno| to \LaTeX's counter so that the
|\label| macro works correctly. Also, \LaTeX\ does its own thing with the
|\end| command.
\catcode`\@@=11
\ifLaTeXisloaded
\let\pageno\c@@page% \WEB\ has its own name for the page number.
\def\FWEBend{\let\clearpage\newpage% Otherwise, one gets a blank page.
\end{document}}% \LaTeX\ redefines |\end|.
\else
\let\FWEBend\end
\catcode`\@@=12
@ We can comment stuff out by bracketing it with |\comment...\endcomment|.
\long\def\comment#1\endcomment{}
@ Here's how to refer to the individual processors. The user may wish to
redefine these.
\def\WEB{\Wtypewriter{WEB}}
\def\FWEB{\Wtypewriter{FWEB}}
\def\CWEB{\Wtypewriter{CWEB}}
\def\TANGLE{\Wtypewriter{TANGLE}} \let\Tangle\TANGLE
\def\WEAVE{\Wtypewriter{WEAVE}} \let\Weave\WEAVE
\def\FTANGLE{\Wtypewriter{FTANGLE}}
\def\FWEAVE{\Wtypewriter{FWEAVE}}
@ Here's how one can refer to the individual languages. The user may also wish
to redefine these.
\def\C{C}
\def\Cpp{\C{\tt ++}}
\def\FORTRAN{{\Csc Fortran}} \let\Fortran\FORTRAN
\def\MAKE{{\tt MAKE}} \let\Make\MAKE
\def\RATFOR{{\Csc Ratfor}} \let\Ratfor\RATFOR
\let\TEX\TeX
\def\UNIX{{\SC UNIX}} \let\Unix\UNIX
@ Here's something for trickery with catcodes.
\chardef\other=12
@ Now remember Plain \TeX\ stuff used for other purposes by \FWEB.
\let\amp\&
\let\at\@@
\let\bslash\\
\let\caret\^
\let\dollar\$
\let\dstar\*
\let\equals\=
\let\leftbrace\{
\let\period\.
\let\rightbrace\}
\let\vertbar|
\let\PM\#
\let\PC\%
@ Additionally, the TeXbook manual macro package \.{manmac} redefines the
following stuff:
|\iftitle \titlefont \rhead \pagewidth \pageheight \output|
\noindent If you want to include \.{manmac.tex} to get various macro
definitions, the best scheme is to use the `\.{-w}'~command-line option to
prevent \FWEAVE\ from outputting |\input fwebmac.sty| as the first output line.
Then include both files explicitly, in this order:
|\input manmac|
|\input fwebmac.sty|
\noindent You can do this by defining the first limbo text command as
follows:
|@@l "\\input manmac \\input fwebmac.sty"|
@ Paragraph skip and indentation for \TeX\ text:
\newdimen\pardimen
\dimen0=\normalbaselineskip
\parskip=\dimen0 plus 1pt
% If you don't like spaces between paragraphs, change |\pardimen| to |0pt|.
\pardimen=\parskip
\parskip 0pt% No stretch between paragraphs
% Indentation for the \TeX\ part is handled in a separate variable
% |\TeXindent| from the variable |\notch| used for definition and code parts.
\newdimen\TeXindent
\TeXindent 1em% For paragraphs in the \TeX\ part.
@* FONTS. Several fonts have been declared in addition to the standard of
\.{PLAIN} format:
$$\vbox{\halign{\.{\\#}\quad\hfil&---\quad#\hfil\cr
titlefont&\titlefont Title.\cr
ttitlefont&\ttitlefont Title.\cr
SC&\SC SMALL CAPS.\cr
Csc&\Csc CAPS/Small caps.\cr
tentex&\tentex \TeX\ extended character set, including~'\.{\ }'.\cr
bfit&\bfit Bold-faced italic.\cr
The font used for comments is called |\cmntfont|. By default, this is
|\let| to |\tenrm|.
\ifx\selectfont\undefined
\let\mainfont\tenrm \let\cmntfont\tenrm
\font\eightrm=cmr8 \let\SC\eightrm
\font\titlefont=cmssbx10 scaled \magstep2% Sans serif
\font\ttitlefont=cmtt10 scaled\magstep2% Typewriter type
\font\tentex=cmtex10 % \TeX\ \.{extended char.\ set} (used in strings)
\font\Csc=cmcsc10 % Caps/small caps.
\font\tenbfit=cmbxti10 % \&{Intrinsic functions}
% Used for module-number subscript:
\font\seventi=cmti7
\font\sevenrm=cmr7
\font\sevenbf=cmbx7
% For special handling of array indices:
\font\sevenit=cmti7
\scriptfont\itfam=\sevenit
@%\font\fiveit=cmti5
@%\scriptscriptfont\itfam=\fiveit
\scriptscriptfont\itfam=\sevenit
\else % NFSS
\def\mainfont{\fontfamily{\rmdefault}\fontseries{m}\fontshape{n}%
\normalsize}
\let\cmntfont\mainfont
\def\eightrm{\fontfamily{\rmdefault}\fontseries{m}\fontshape{n}%
\footnotesize}
\let\SC\eightrm
\def\titlefont{\fontfamily{\sfdefault}\fontseries{\bfdefault}%
\fontshape{n}\Large}
\def\ttitlefont{\fontfamily{\ttdefault}\fontseries{m}\fontshape{n}%
\Large}
\def\tentex{\fontfamily{\ttdefault}\fontseries{m}\fontshape{n}%
\normalsize}
\def\Csc{\fontfamily{\rmdefault}\fontseries{m}\fontshape{\scdefault}%
\normalsize}
\def\tenbfit{\fontfamily{\rmdefault}\fontseries{\bfdefault}%
\fontshape{\itdefault}\normalsize}
\def\seventi{\fontfamily{\rmdefault}\fontseries{m}%
\fontshape{\itdefault}\scriptsize}
\def\sevenrm{\fontfamily{\rmdefault}\fontseries{m}\fontshape{n}%
\scriptsize}
\def\sevenbf{\fontfamily{\rmdefault}\fontseries{\bfdefault}%
\fontshape{n}\scriptsize}
\def\fiveti{\fontfamily{\rmdefault}\fontseries{m}%
\fontshape{\itdefault}\tiny}
\def\fiverm{\fontfamily{\rmdefault}\fontseries{m}\fontshape{n}\tiny}
\def\fivebf{\fontfamily{\rmdefault}\fontseries{\bfdefault}%
\fontshape{n}\tiny}
\def\tensy{\fontfamily{cmsy}\fontseries{m}\fontshape{n}\normalsize}
\def\pbf{\fontfamily{\rmdefault}\fontseries{\bfdefault}\fontshape{n}%
\selectfont}
\def\ptt{\fontfamily{\ttdefault}\fontseries{m}\fontshape{n}\selectfont}
% The next isn't really sufficient; this ought to be put into
% the definitions of |\tenpoint|, |\twelvepoint|, etc.
\let\bfit\tenbfit
@* HIGHLIGHTING MACROS. These are used for displaying identifiers,
reserved words, intrinsic functions, etc.
\def\Wshort#1{\leavevmode\hbox{$#1$}}% One-letter identifiers such
% as~\Wshort{x} look better this way.
\def\Wid#1{\leavevmode\hbox{\it#1\/\kern.05em}}% Italic type for ordinary
% identifiers such as \Wid{test}.
% By default, macros are formatted the same way as ordinary identifiers.
% However, you can change the following definitions to get special effects.
% Either make your own version of |fwebmac.sty| (use a change file with
% |fwebmac.web|), or redefine |\WidD| and/or |\WidM| with an \.{@@l} command.
\let\WidD\Wid % Outer macro
\let\WidM\Wid % WEB macro
\def\Wreserved#1{\leavevmode\hbox{\def\\{\tt\BS}\bf#1\/}}% Boldface type
% for reserved words such as \&{integer}.
\def\Wintrinsic#1{\leavevmode\hbox{\def\\{\tt\BS}\bfit#1\/\kern.05em}}%
% Library/intrinsic function name such as \@@{sin}.
% In the following, we use |\gdef| instead of |\global\let| because we
% might want to change the definition of, e.g., |\WidM| with an \.{@@l}
% command, which comes \It{after} the |\Wbegin| statement.
\def\Wequate#1#2#3#4#5#6#7#8{%
\gdef#1{\Wreserved}% |\&| by default.
\gdef#2{\Wshort}% |\|| by default.
% Don't reorder the following three statements! In case arguments 3--5 are
% identical, we want the ordinary identifier to win.
\gdef#5{\WidM}% |\\| by default.
\gdef#4{\WidD}% |\\| by default.
\gdef#3{\Wid}% |\\| by default.
\gdef#6{\Wintrinsic}% |\@@| by default.
\gdef#7{\Wkeyword}% |\.| by default.
\gdef#8{\Wtypewriter}}% |\.| by default.
@ Identifiers that are recognized as function or macro names are followed
by the construction\hfil\break
\.{\\WIN\{{\it name}\_{\it type}\}\{{\it module}\_{\it number}\}}. The
cases for the first argument correspond to
$$\vbox{\halign{#\hfil&\ ---\ #\hfil\cr
0&Generic name, defined by \.{@@[}.\cr
1&Function name.\cr
2&\WEB\ macro (\.{@@m}).\cr
3&Outer macro (\.{@@d}).\cr
4&Reserved name defined with~\.{@@`}.\cr
5&|@c typedef| name.\cr
If the name was defined in the current module, the second argument will be
zero; otherwise it will be the section number in which the name was
defined. The macro shows how to display the 0~state differently (here with
a bullet). Also, note how combinations of underlining and fonts are used
to distinguish the various kinds of identifiers.
\def\Wzero{0}
\def\WIN#1#2{\ifmmode\def\ZZ{}\else\def\ZZ{\null$\null}\fi
\ZZ_{\def\next{#2}\ifx\next\Wzero{\bullet}\else\WINo{#1}{#2}\fi}\ZZ}
% Format the module-number subscript.
\def\WINo#1#2{%
\ifcase#1\underline{\hbox{\sevenrm#2}}% Generic name (\.{@@[}). [0]
\or\hbox{\sevenrm#2}% Function name. [1]
\or\underline{\hbox{\seventi#2}}% WEB macro. [2]
\or\hbox{\seventi#2}% Outer macro. [3]
\or\underline{\hbox{\sevenbf#2}}% \.{@@`}. [4]
\or\hbox{\sevenbf#2}% \&{typedef}. [5]
\else{#2}% Error trap.
\fi}
@* STRINGS. Strings are indicated by ``\.{\\.\{\dots\}}''. You can also
use this for typewriter type; remember to escape the appropriate symbols:
``\.{\ \\\#\%\$\^\{\}\~\&\_}''. The string macro itself does not surround
its contents with an |\hbox|, in order that long strings can be broken by
discretionaries.
\def\Wtypewriter#1{\relax\ifmmode\gdef\YY{\null$\null}\else\gdef\YY{}\fi
\YY{\leavevmode\INITSTR#1}\YY}
\let\Wkeyword\Wtypewriter
@ Here is the nucleus for the string macro~|\.| (more precisely, for
|\Wtypewriter|).
\def\INITSTR{%
\tentex % Typewriter type for strings
\let\\=\BS % Backslash in a string: '\.\\'.
\let\'=\RQ % Right quote in a string: '\.\''.
\let\`=\LQ % Left quote in a string: '\.\`'.
\let\{=\LB % Left brace in a string: '\.\LB'.
\let\}=\RB % Right brace in a string: '\.\RB'.
\let\~=\TL % Tilde in a string: '\.\~'.
\let\ =\SP % Space in a string: '\.\ '.
\let\_=\UL % Underline in a string: '\.\_'.
\let\&=\AM % Ampersand in a string: '\.\&'.
\def\0{\discretionary{\BS}{}{}}% FWEB inserts this automatically every
% so often so very long strings will break. Broken strings will
% be marked by a backslash.
\def\1{,\0}% FWEB replaces commas in strings by this, so strings
% tend to break after commas.
\let\2\space % Ordinary space after control sequences in \TeX.
\def\3{\space\space}% Translation of a tab in \TeX.
@ Characters for strings:
\def\#{\hbox{\tt\char35}}% Parameter sign: '\#'.
\def\${\hbox{\tt\char36}}% Dollar sign: '\$'.
\def\%{\hbox{\tt\char37}}% Percent sign: '\%'.
\def\^{\ifmmode\raise0.45ex\hbox{$\,\scriptstyle\mathchar"25E\,$}%
\else\char`^ \fi}% Pointer or
% hat: '\^'.
% Circumflex accents can be obtained from |\^^D| instead of |\^|.
\def\AT!{@@}% At sign for control text: '\AT!'
@ The following funny business about asterisks is in case you want to be
clever and make~`\.*' an active character (for example, for complex
conjugation).
\chardef\asterisk=`\*
\def\ast{\ifmmode{\displaystyle\mathchar"2203}\else\asterisk\fi}
@ More stuff for strings.
\chardef\AM=`\&% Ampersand character in a string: '\.\&'.
\chardef\BS=`\\% Backslash in a string: '\.\\'.
\def\ttBS{{\tt\BS}}% Literal backslash: '\ttBS'.
\chardef\LB=`\{% Left brace in a string: '\.\LB'.
\def\LQ{{\tt\char'22}}% Left quote in a string: '\.\`'.
\chardef\RB=`\}% Right brace in a string: '\.\RB'.
\def\RQ{{\tt\char'23}}% Right quote in a string: '\.\''.
\def\SP{{\tt\char`\ }}% (Visible) space in a string: '\.\ '.
\chardef\TL=`\~% Tilde in a string: '\.\~'.
\chardef\UL=`\_% Underline character in a string: '\.\_'.
\def\LA{\hbox{\LQ}}% Left quote outside a string
@* INDENTATION, LINEBREAKS, etc. These commands are mostly handled by the
macros~|\1| to~|\8|.
First, here are some macros to draw vertical lines to show off the indentation
scheme.
\newbox\rulebox
\newcount\ruleno
\def\rules#1{\leavevmode
\ruleno=0
\rlap{\vtop to 0pt{\null
\def\R{\setbox0=\hbox{\the\ruleno}%
\rlap{\vrule height0pt depth#1}%
\kern-0.5\wd0\copy0\kern-0.5\wd0
\advance\ruleno by1
\hskip1em}
\rlap{\R\R\R\R\R\R\R}
\vss}}}
@ The indentation scheme is as follows. The unit of indentation is
|\notch|.
\newdimen\notch
\notch 1em
@ Here is typical output.
\setbox\rulebox\vtop{\null
\WY $\WP\WE:if:\WO{1}{}$\par
\WP\WMd$\@|A\WIN2{0}$\5
$\WO{2}{}$\par
\WP\WE:endif:\par
\WP\WMD$\\{ALPHA}$\5
$\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+%
\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+%
\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+%
\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+%
\\{xxx}+\\{yyy}+\\{xxx}{}$\par
\WY\WP$\\{main}(\,)$\1\1\6
\&{int} \1\\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, %
\\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, %
\\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde}, \\{abcde};\2%
\2\2\1\6
$\{{}$\6
\WE:if:$\WO{1111}+\WO{2222}+\WO{1111}+\WO{2222}+\WO{1111}+\WO{2222}+\WO{1111}+%
\WO{2222}+\WO{1111}+\WO{2222}+\\{aaaa}+\\{bbbb}+\WO{1111}+\WO{2222}+\WO{1111}+%
\WO{2222}+\WO{1111}+\WO{2222}+\WO{1111}+\WO{2222}+\WO{1111}+\WO{2222}$\WPs\7
$\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+%
\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+%
\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\{yyy}+\\{xxx}+\\z;{}$%
\WE:endif:\WPs\6
$\}$\2\WY\par
\vbox{\noindent\rules{\dp\rulebox}\box\rulebox}
Preprocessor commands in the definition part are far left, definition-part
commands such
as~\.{@@m} are indented one notch, function names are at two notches, and
the body of functions is at three notches. This distance is given the
special name |\globalindent|:
\newcount\globalindent
\globalindent=3 % Global indentation in notches.
@ The current indentation is called |\ind|. We also sometimes need to save
and restore that.
\newcount\ind % Current indentation in notches.
\newcount\lastind % Used for preprocessor commands.
\def\saveind{\global\lastind=\ind}
@ Each output line of code is a separate paragraph. The scheme proceeds by
first setting |\ind|~to the appropriate hanging indentation, then
backspacing appropriately. Here are the backspace quantities.
\newbox\bak \setbox\bak=\hbox to -\notch{}% Backspace one notch.
\newbox\bakk \setbox\bakk=\hbox to -2\notch{}% Backspace two notches.
@ When there's the possibility that a line of code may be continued, we
advance the indentation and set |\hangindent|.
\def\1{\global\advance\ind by1\hangindent\ind\notch}% Indent one more notch
@ Here we cancel the above. We don't need to reset |\hangindent| because
this will always be followed by a~|\6| or~|\7|, which already does that.
\def\2{\global\advance\ind by-1{}}% Indent one less notch
@ Now we provide for an optional break within a statement. (Note that the
argument is multiplied by~10.)
\def\3#1{\hfil\penalty#10\hfilneg}% Optional break within a statement.
@ A simple command to backspace one notch.
\def\4{\copy\bak}% Backspace one notch
@ Optional break (the |\yskipfalse| may be obsolete).
\def\5{\hfil\penalty-1\hfilneg \kern2.5\notch\copy\bakk
\yskipfalse\ignorespaces}
@ The next command forces a line break.
\def\6{\ifmmode\else\par
\hangindent\ind\notch \noindent \kern\ind\notch \copy\bakk \ignorespaces\fi}
@ This also forces a line break, but also adds some extra vertical space.
\def\7{\WY\6}% Forced break and a little extra space.
@ No indentation.
\def\8{\hskip-\ind\notch \hskip 2\notch}
\newif\ifyskip
\def\yskip{\medskip}
@* PREPROCESSOR COMMANDS. The preprocessor commands are built out of the
previous ones.
First, we define a guaranteed space.
\def\Hspace{\hbox{ }}
@ Start a preprocessor command such as \.{@@\#if}. When these are issued
in the
code section (rather than in the definition section), we must remember the
present level of indentation. That's restored with~|\WPs|.
\def\WPR#1{\copy\bakk \saveind% |\global\advance\ind by 2|
\1\Wreserved{@@#1}\Hspace}
\def\WPs{\global\ind=\lastind}
@ The definition commands such as~\.{@@m} are similar, except that they
also take a language argument.
\def\defin#1#2{\4\saveind
\1\Wreserved{#1}\hbox{$^{\rm#2}$}\Hspace}% Begin @@d, @@m, or @@f.
@* Various NUCLEII.
\def\note#1#2.{\WY\noindent{\hangindent2em\baselineskip10pt\eightrm#1 #2.\par}}
\def\lapstar{\rlap{*}}
% If there's a current include file, it's printed at the start of each section.
\def\includefile{}
\def\WIF#1{\def\includefile{#1}}
\def\startsection{\WQ\noindent{\let\*=\lapstar\bf\modstar.%
\ifx\includefile\empty\else\ [{\tt\includefile}]\fi\quad}}
@* ALPHABET macros. These are hard-coded into \FWEAVE.
@*1 Comments. Comments are C-style. The long comment construction `|/* ...
*/|' is output as `|\WC{ ... }|'; the short comment is output as `|\Wc{ ...
}|'. The |\WC| and~|\Wc| macros aren't simply defined with an argument
whose text would be the comment because one wants the comment to be a group
and the user might be wanting to change catcodes inside that group; the
argument form would absorb catcodes before they were changed.
\def\skipbrace#1{\catcode`\{=1 }
\def\WC{\Wcmnt{\ast}{\finishcomment}}
\def\Wc{\Wcmnt{/}{\XX}}
\def\Wcmnt#1#2{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi% C-style cmnt
\XX\hfil\penalty-1\hfilneg
\ifyskip\else\quad\fi$/#1\,$%
\bgroup\cmntfont % The user can redefine the comment font |\cmntfont|.
\aftergroup#2%
\catcode`\{=\other\skipbrace}
\def\finishcomment{$\,\ast/$\XX}
\def\Wx#1{\kern-0.5\notch\hbox{\tt\%}}
@ Compiler directives are essentially comments, but are formatted more like
preprocessor commands.
\def\WCDIR#1{\WPR!\Wtypewriter{#1}\WPs}
@*1 Code mode. Code mode is entered by vertical bars, giving an effect
such as |@c x=y|.
\def\WCD#1{\ifmmode\hbox\fi{\ignorespaces#1}}
@*1 Definitions. Various definition section stuff.
\def\WD:#1:{\defin{@@D}{#1}}% Outer macro definition: `\.{@@D}'
\def\Wd:#1:{\defin{@@d}{#1}}% Outer macro definition: `\.{@@d}'
\def\WUd:#1:{\defin{@@u}{#1}}% Undef outer macro: `\.{@@u}'.
\def\WMD{\defin{@@M}{}}% WEB macro definition: `\.{@@M}'.
\def\WMd{\defin{@@m}{}}% WEB macro definition: `\.{@@m}'.
\def\WE:#1:{\WPR{\##1}}% WEB preprocessor command: `\.{@@\#if\dots}'.
\def\WF:#1:{\defin{@@f}{#1}}% Format definition: `\.{@@f}'.
\def\Wl:#1:{\defin{@@l}{#1}}% Limbo text definition: `\.{@@l}'.
\def\Wv:#1:{\defin{@@v}{#1}}% Operator overloading: `\.{@@v}'.
\def\WWW:#1:{\defin{@@W}{#1}}% Identifier overloading: `\.{@@W}'.
\def\Ww:#1:{\defin{@@w}{#1}}% Identifier overloading: `\.{@@w}'.
@*1 Sections.
The following takes care of the new \LaTeX\ processing.
\def\Wunnamed#1#2{}
@ Beginning of ordinary section (begun with~`\.{@@\ }').
\outer\def\WM#1.{\MN#1.\Wmark\ifon\Wskip\startsection\ignorespaces}
@ Beginning of starred section (begun with~`\.{@@*}'). Starred sections
have associated level numbers, where 0~denotes the most significant level,
1~denotes a subsection, 2~denotes a subsubsection, and so on. You can
indicate the level number in several ways. By default, you can say
``\.{@@*3\ Section name.}'' or equivalently ``\.{@@*...\ Section name.}''
to set the level number to~3. Alternatively, if you replace the line below
``\.{\\dotsafterfalse}'' with ``\.{\\dotsaftertrue}'', you can instead say
``\.{@@*\ Section name....}'' By default, major sections get a page break;
subsections don't. Sections and subsections can be formatted in different
ways in the table of contents by enhancing the definition of~|\WZ|
(inside~|\Wcon|) to include an |\ifcase| construction. (See how this is
done in |fwebman.tex|.)
\newcount\Wss % Counter for the dots.
\newif\ifdotsafter % Do subsection dots come after or before the section name?
\dotsafterfalse
\ifdotsafter % ``@@* NAME...''
\def\Wbefore:#1.{\Wdefname#1.\Wdot}%
\def\Wafter{\WNss}%
\else % ``@@*.. NAME.'' or ``@@*2 NAME.''
\def\Wbefore: #1{\def\next{\Wafter#1}% Case for neither dot nor number.
\ifx#1.\def\next{\Wdot.}% Count arbitrary dots.
\else\ifx#11\Wsectionnum1%
\else\ifx#12\Wsectionnum2%
\else\ifx#13\Wsectionnum3%
\else\ifx#14\Wsectionnum4% Highest numerical level allowed.
\fi\fi\fi\fi\fi
\next}%
\def\Wafter#1.{\Wdefname#1.\WNss}% Executed after figuring out level.
\def\Wsectionnum#1{\Wss#1\let\next\Wafter}% Assign numerical section number.
\def\Wdefname#1.{\def\Wname{#1}}% Remember name of section.
\outer\def\WN#1.{\MN#1.\Wss=0\Wbefore:}% Begin a starred section.
@ Here we count the periods before or after the section name.
\def\Wdot{\futurelet\next\WNs}
\def\WNs{\ifx\next.\advance\Wss by 1\let\next\Wnext\else\let\next\Wafter\fi
\next}
\def\Wnext#1{\Wdot}
@ Now actually begin the section. Note the use of~|\ifcase| to
conditionally format the sections and subsections. Also, the construction
|\ifon...\fi| brackets the section to conditionally suppress printing.
Finally, we make an entry in the table of contents for all starred names.
The first argument of the \.{\\WZ}~macro is the level number for this
section. This can be used to format the table of contents in various ways.
The order of expansion is an issue in the~|\write| to the table of contents
file~|\cont|. We want the macro~|\WZ| to be sent unexpanded, so we
|\let|~it equal to a primitive. Also, it's possible that a~|\WIN| will
appear inside of~|\Wname| (if the user included certain kind of code inside
the section name). This shouldn't be expanded until later, so we turn that
into the temporarily unexpandable macro~|\WIM|.
% Page break for major sections.
\def\Wsectionbreak{\ifcase\Wss\vfil\eject\fi}
% Running headline.
\def\rhead{\ifcase\Wss
\uppercase{\ignorespaces\Wname}%
\else
\ignorespaces\Wname%
\fi}% Define running headline.
\let\WZ\let % Now you can |\send| the control sequence |\WZ|
\let\WIM\let % This macro is made temporarily unexpandable; see |\WZ|.
\def\WNss{%
\Wmark % Can't put this in |\MN| since |\rhead| must be defined first.
\Wsectionbreak % Typeset the break between sections.
\message{*\modno}% Progress report to the terminal.
\ifon
\ifcase\Wss\else\Wskip\fi
\startsection{\bf\ignorespaces\Wname.\quad}%
{\def\WIN{\WIM}%
\edef\next{\write\cont{\WZ{\the\Wss}{\Wname}%
{\modno}{\noexpand\the\pageno}}}\next}%
% To contents file |CONTENTS.tex|.
\ignorespaces}
@ The marks that we emit just before |\Wsectionbreak| are of the form
``{\it modno}|\else|{\it section name}''. We use both of the parts in the
page headers. In handling the section name, we must take care to avoid
expanding the macro~|\WIN| prematurely. This is done just as in~|\WNss| above.
\def\WmarkN{\def\Wmark{{\def\WIN{\WIM}
\mark{\modno\noexpand\else\rhead}}}}
\ifx\selectfont\undefined
\WmarkN
\else
\def\Wmark{{\def\WIN{\WIM}\let\protect\noexpand
\mark{\modno\noexpand\else\rhead}}}
\def\Wmodno{\iftrue\topmark\fi}% Extracts the left-hand part of the mark.
\def\Whead{{\let\WIM\WIN
\expandafter\iffalse\topmark\fi}}% Extracts the right-hand part.
@ Common code for |\WM|, |\WN|.
\catcode`\@@=11
\def\MN#1.{\par
\parskip=\pardimen % Reset to \TeX\ spacing
\parindent=\TeXindent
{\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}
\ifLaTeXisloaded
\xdef\@@currentlabel{\modno}%
\ifx\modno\modstar \onmaybe \else\ontrue \fi}
\catcode`\@@=12
@*1 Constants. Various kinds of constants are handled: decimal~(|@c 10|),
hexadecimal~(|@c 0xA|), octal~(|@c 012|), boolean~(|@c 0b1010|),
floating-point (|@c 1.5e-35|), double-precision (|@n @e3.2d100|),
long (|@c 99999L|), unsigned (|@c 99999U|),
unsigned long (|@c 999999UL|), and Hollerith (|@r 3Habc|).
\def\WDP#1{\ifx E#1\else{\tt#1}\fi}% Used in the exponent macro below.
\def\WO#1{%
{% Make the next definitions local.
\let\-\_%
\let\d\$%
\def\\{\let\_\-\let\$\d}%
\def\?{\kern.2em}%
\def\###1{\kern0.1em{\tt \ifcase##1F\or L\or U\or UL\else?\fi}}%C~constant.
\def\^##1{\cdot 10^{\aftergroup}\aftergroup\WDP\aftergroup##1}% Power of ten
\def\_{_{\\\rm\aftergroup}}% Fortran-90 kind parameter.
\def\%{{\rm H}\hbox{\aftergroup}\Wtypewriter{\aftergroup}}% Hollerith constant
\def\&{0{\tt b}}% Binary constant.
\def\~{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}}% Octal
\def\`{\hbox{\rm\char"7D\tt\aftergroup}}#1}}% Double quotes for hex constant
@*1 Code mode. Either begin the code section, or a preprocessor or
definition command.
The following command sets up~|\ind|. This somewhat peculiar construction
is for historical reasons.
\def\WPr{\global\ind=\globalindent \1}
@ Now enter code mode. Note that |\leavevmode| starts a new indented
paragraph; we then move in one more notch.
\def\WP{\parskip=0pt \parindent=\notch
\rightskip=0pt plus 100pt minus 10pt
\sfcode`;=3000
\pretolerance 10000
@#if 0
\hyphenpenalty 10000 \exhyphenpenalty 10000 % If you turn these on, the
% discretionary breaks in strings won't work!
\global\ind=\globalindent \1\ \unskip}
@#endif
\WPr
\leavevmode\kern\notch}
@ Here we leave code mode:
\def\WQ{\rightskip=0pt
\sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 }
@*1 Miscellaneous operators.
\def\WA{\note{See also}}% Cross-reference for multiply defined section names.
\def\Wauto[#1]{\Wtypewriter{[#1]}\ }
\def\WB{\mathopen{\Wtypewriter{@@/\ast}}}% Begin controlled comment.
\let\WG\ge % Greater than or equal sign: '$\WG$'.
\let\WI\neq % Unequal sign: '$\WI$'. (Better reserve |\ne| for the
% electron density~$n_e$.)
\def\WJ{\Wtypewriter{@@\&}}% TANGLE's join operation: '\WJ'.
\let\WK\gets % Left arrow: '$\WK$'.
\let\WL\le % Less than or equal sign: '$\WL$'.
\def\Wskip{\vfil\penalty-100\vfilneg \vskip12ptminus3pt}% See |\WM|, etc.
\def\Wskipped#1{\8\mathhexbox278.\quad\Wtypewriter{@@I "#1"}\ \ {\it Section(s)
skipped}\dots\WP}
\let\WPtr\Rightarrow % Fortran's stupid pointer assignment statement:
% '$\WPtr$'.
\let\WR=\lnot % Logical not: '$\WR$'.
\let\WS=\equiv % Equivalence sign: '$\WS$'.
\def\WT{\mathclose{\Wtypewriter{@@\ast/}}}% Terminate controlled comment.
\def\WU{\note{This code is used in}}% Cross-reference for uses of sections.
\let\WV\lor % Logical or: '$\WV$'.
\let\WW=\land % Logical and: '$\WW$'.
@ Here's how to format a section name. Argument~1 is the name, argument~2
is the section number, and argument~3 is the language symbol.
\def\WX#1:#2\X#3\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi
\XX$\langle\,$#2{\eightrm\kern.5em#1}$\,\rangle^{\rm #3}$\XX}
\def\WY{\par\parskip=0pt\yskip}
@* VARIOUS OPERATORS.
The following were for Pascal.
@<Unused@>=
\def\){\hbox{\Wtypewriter{@@\$}}}% sign for string pool check sum
\def\]{\hbox{\Wtypewriter{@@\\}}}% sign for forced line break
@ For C's construciton `|@c x ? 1 : 0|'.
\def\?{\mathrel?}
@ Colons have several uses.
\def\Colon{\ifmmode\colon\else:\fi}
\def\CC{\mathord{::}}% '$x\CC y$'.
\def\CF{{}\mathbin{::}{}}% '$x\CF y$'.
@ Verbatim strings are boxed for emphasis, like this: \Wequals{This is a
verbatim string.}
\def\=#1{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
\hbox{\strut\kern2pt\Wtypewriter{#1}\kern2pt}}
\hrule}\vrule}\kern2pt}
\let\Wequals\=
\let\~=\ignorespaces
\let\*=*
@ The following symbol is used to denote accretions to already-existing
modules.
\def\PQ{\mathrel{+\mathord\equiv}}% '$\PQ$'.
\mathchardef\TLD="0218% '$\TLD$'.
\def\PP{\mathord{++}}% '$\PP$'.
\def\MM{\mathord{--}}% '$\MM$'.
\def\MG{\mathord{\to}}% '$\MG$'.
@ The exponentiation macros strip away outer parentheses from the argument,
turning ``|x^(a+b)|'' into ``|@n x^(a+b)|''.
\def\LP{(}% Must be |\def|, not |\let|.
\def\ISL#1#2]{\def\next{#1}}
\def\EE#1{\ISL#1]\ifx\next\LP\EXP[#1]\else\EXP[(#1)]\fi}
\def\EXP[(#1)]{^{#1}}
@#if 0
\def\EE{\mathord{\hbox{\tt\^}}}% Poor-man's exponentiation; above is better.
@#endif
\let\SlSl\parallel% Concatenation: '$\SlSl$'.
@ For \Fortran--90's `|@n (/a,b,c/)|'.
\def\LS{\mathopen{({/}}}
\def\SR{\mathclose{{/})}}
@ Macro stuff:
\def\NN{\hbox{\#\#}}% '\NN'.
\def\NP{\hbox{\#!}}% '\NP'.
\def\NC{\hbox{\#:}}% '\NC'.
\def\ND{\hbox{\#.}}% '\ND'.
\def\Nq{\hbox{\#\tt'}}% '\Nq'.
\def\NQ{\hbox{\#\tt"}}% '\NQ'.
@ The standard \Fortran\ \.{.FALSE.} and \.{.TRUE.} operators.
\def\FALSE{{\cal F}}% '$\FALSE$'.
\def\TRUE{{\cal T}}% '$\TRUE$'.
@ Compound operators. The following are for~C.
\def\Wcp{\mathrel{+{=}}} \let\PE\Wcp % `$x\PE y$'.
\def\Wcm{\mathrel{-{=}}} \let\ME\Wcm % `$x\ME y$'.
\def\Wcs{\mathrel{\ast{=}}} \let\TE\Wcs % `$x\Wcs y$'.
\def\Wcv{\mathrel{/{=}}} \let\FE\Wcv % `$x\FE y$'.
\def\Wcd{\mathrel{\%{=}}} \let\CE\Wcd % `$x\Wcd y$'.
\def\Wcx{\mathrel{\^\!{=}}}% `$x\Wcx y$'.
\def\Wca{\mathrel{\amp{=}}}% `$x\Wca y$'.
\def\Wco{\mathrel{\OR{=}}}% `$x\Wco y$'.
\def\Wcg{\mathrel{\GG\!{=}}}% `$x\Wcg y$'.
\def\Wcl{\mathrel{\LL\!{=}}}% `$x\Wcl y$'.
\def\EQV{\mathrel{?{=}}}% `$x\EQV y$'.
\def\NEQV{\not\equiv}% `$x\NEQV y$'.
@ More C operators.
\def\MOD{\mathrel{\%}}% `$x\MOD y$'.
\def\OR{{\,|\,}}% `$x\OR y$'.
\def\AND{{\,\amp\,}}% `$x\AND y$.
\def\GG{\mathrel{>\!>}}% `$x\GG y$'.
\def\LL{\mathrel{<\!<}}% `$x\LL y$'.
\def\HE{\mathrel{\uparrow=}}% `$x\HE y$'.
@ We allow braces to be easily displayed outside of math mode.
\let\openbraces=\{
\let\closebraces=\}
\def\{{\ifmmode\openbraces\else$\openbraces$\fi}
\def\}{\ifmmode\closebraces\else$\closebraces$\fi}
@ Metacomments:
% Print the meta-comment symbols.
%\def\WBM{\6\8\Wreserved{@@(}}
%\def\WEM{\6\8\Wreserved{@@)}}
% Don't print the meta-comment symbols.
\def\WBM{}
\def\WEM{}
@ Block/loop numbers in \Fortran. \It{Note: You can't replace the
|\bgroup| and |\egroup| by braces because of peculiarities of~|\Wc|. Also,
if you put an explicit comment on a line that will be labelled by
|\Wblock|, with the following definition you'll get two comments side by
side. However, this could be modified by setting a counter to the block
number and making a fancier definition of~|\WC| and~|\Wc|.}
\def\Wblock#1{\Wc\bgroup\ Block #1\egroup}% `\Wblock{99}'
@* OVERLOADING OPERATORS. Operator overloading is annoying because several
languages may be in use simultaneously. Therefore, when we define an
overloaded macro name, we append to it the language symbol, creating
macros such as |\op_C|. These macros are typically defined automatically
at the beginning of the output file from information contained in
\.{@@v}~commands.
\newif\ifop
\newbox\dotbox
\def\Wunknown#1{\={??#1??}}% For unknown dot constant.
{\catcode`\_=11
\gdef\newop#1#2#3{%
\edef\next{\def\expandafter\noexpand\csname _#1_#2\endcsname}%
\next{#3}}
\gdef\newbinop#1#2#3{%
\edef\next{\def\expandafter\noexpand\csname _#1_#2\endcsname}%
\next{\mathrel{#3}}}
\gdef\newunop#1#2#3{%
\edef\next{\def\expandafter\noexpand\csname _#1_#2\endcsname}%
\next{\mathbin{#3}}}
\gdef\Wop#1#2{\setbox\dotbox\hbox{\tt .#1.}%
\edef\nxt{\expandafter\noexpand\csname _#1_#2\endcsname}%
\edef\ifnxt{\noexpand\ifx\expandafter\noexpand\csname _#1_#2\endcsname}%
\ifnxt\empty
\def\next{\box\dotbox}% Macro not defined; just use \.{.NAME.}.
\else
\def\next{\futurelet\nextchar\Woq}% Be careful about |\EE|.
\next}%
\global\let\Wb\Wop
\global\let\Wu\Wop
\let\Lbrace{
\def\Woq{\ifx\nextchar\Lbrace
\let\next\nxt % There's an argument coming up.
\else
\ifop
\def\next{\nxt{}\equiv\box\dotbox}%
\else
\let\next\nxt
\fi
\opfalse
\next}
@ The following is for special handling of array indices.
\newtoks\WARRAYarga
\newtoks\WARRAYargb
\def\WXA#1{\begingroup
% We don't want the identifiers to be in hboxes, because we want to get
% |\scriptstyle| for subscripts. (We should always be in math mode here.)
\def\Wshort##1{##1}%
\def\Wid##1{{\it ##1\/\kern.05em}}%
\global\WARRAYarga{#1}%
\futurelet\Wnext\WARRAYm}
\def\WARRAYm{\ifx\Wnext\WXA
\global\let\Wnext\WARRAYn% Multiple indices in C: a[i][j][k]
\else
\global\let\Wnext\relax
\WARRAY{\the\WARRAYarga}% Typeset the accumulated indices.
\endgroup
\Wnext}
\def\WARRAYn#1#2{\WARRAYargb{#2}%
\edef\Wnext{\noexpand\WXA{\the\WARRAYarga,\the\WARRAYargb}}%Concatenate
\Wnext}
% Change the following definition to get indices printed in interesting ways.
\def\WARRAY#1{[#1]}% Default definition.
\def\WSUB#1{_{\scriptstyle#1}}% E.g., subscript indices.
@ Handle the \.{@@o}~command.
\def\Wouto#1#2{\Wreserved{@@#1}\Hspace\Wtypewriter{#2}}
\def\Wout#1{\Wouto{o}{#1}}
\def\WOut#1{\Wouto{O}{#1}}
@* TITLES. Now we deal with the overall page format.
If you want to list only the modules that have changed,
together with the index, put the command `|\let\maybe=\iffalse|' in
the limbo section before the first module of your \.{WEB} file. It's
customary to make this the first change in your change file.
\newif\ifon
\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue
@ Some flags, and the number of the table of contents.
\newif\iftitle \newif\ifpagesaved
\newcount\contentspageno
@ Top line on left-hand pages:
\def\lheader{\mainfont\the\pageno\eightrm\qquad\Whead\hfill\Wtitle\qquad
\ifnum\pageno=\contentspageno\else
\tensy x\mainfont\Wmodno
\fi}
@ Top line on right-hand pages:
\def\rheader{\ifnum\pageno=\contentspageno\else
\tensy x\mainfont\Wmodno
\eightrm\qquad\Wtitle\hfill\Whead
\qquad\mainfont\the\pageno}
@ Here are the page dimensions (in inches).
\def\pagewidtho{6.5}% The width of each page
\def\pageheighto{8.7}% The height of each page
\def\fullpageheighto{9}% Page height including headlines
\newdimen\pagewidth \pagewidth\pagewidtho in
\newdimen\pageheight \pageheight\pageheighto in
\newdimen\fullpageheight \fullpageheight\fullpageheighto in
\newdimen\pageshift \pageshift=0in% Shift righthand pages wrt lefthand ones
\def\magnify#1{\mag=#1
\pagewidth\pagewidtho truein
\pageheight\pageheighto truein
\fullpageheight\fullpageheighto truein
\setpage}
\def\setpage{\hsize\pagewidth \vsize\pageheight}% Use after changing page size.
@ The output routine is for plain \TeX.
\def\page{\box255 }
\newif\ifidenticalpageheads
\def\normaloutput#1#2#3{
\ifodd\pageno\hoffset=\pageshift\fi
\shipout\vbox
\vbox to\fullpageheight
\iftitle\global\titlefalse
\else \hbox to\pagewidth
{\vbox to10pt{}%
\ifidenticalpageheads#2\else
\ifodd\pageno
#3% Pg nos alternate left \& right.
\else#2\fi
\fi
}%
\fi
\vfill#1% Parameter |#1| is the page itself.
\global\advance\pageno by1}
\def\Wname{{\tt FWEB} OUTPUT}% This section name is reset by starred sections.
% An OPTIONAL TITLE can be defined by the user in his limbo section.
\def\Wtitle{}
@ Here we provide a storage place for |\output|. If you include a macro
package, such as \.{manmac}, that overrides the definition of |\output|
\It{after} \.{fwebmac.sty}, you can get back the \.{fwebmac.sty} definition by
saying
|\input manmac|
|\output\Woutput|
\newtoks\Woutput
\Woutput\output% Remember FWEB's definition.
@ It's very useful to know exactly when you made the run.
\newcount\minutes
\newcount\hours
\hours=\time
\divide\hours by 60
\multiply\hours by 60
\minutes=\time
\advance\minutes by -\hours
\divide\hours by 60
\def\Time{\the\hours:\ifnum\minutes<10 0\fi\the\minutes}
\def\Date{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
@* TABLE OF CONTENTS. An entry is made in the table of contents for each
starred section. One can customize things with |\topofcontents| and
|botofcontents|.
\def\topofcontents{\centerline{\titlefont\Wtitle}
\vfill} % This is the default.
@ End the table of contents page:
@#if 0
\def\botofcontents{\vfill}% This makes the bottom of the contents page empty.
@#endif
\def\botofcontents{\vfill
@#if 0
\rightline{My Name}% You can personalize your output here, for example.
@#endif
\rightline{\Date}
\rightline{\Time}}
\contentspageno=0% Default page number for table of contents
@ Here we actually open up the contents file, which is the argument to
|\Wbegin|. The |\Wbegin| macro is issued automatically just before the
stuff for the first module.
\newwrite\cont % For the table of contents.
\def\Wbegin[#1]#2#3#4#5#6#7{\edef\contentsfile{#5}%
\def\readcontents{\input\contentsfile}%
\Wequate#6
\ifLaTeXisloaded
\documentstyle[#1]{#2}%
\textwidth\pagewidth
\textheight\pageheight
\TeXindent#3
\begin{document}
\pageno=2
\else
\TeXindent#3
\notch#4
\output
{\setbox0=\page% The first page is garbage
\immediate\openout\cont=\contentsfile
\global\output{\normaloutput\page\lheader\rheader}%
% Here we print out a garbage page, so that the first |\topmark| won't be null.
\setpage
\vbox to \vsize{}
\def\Wch{\note{The following sections were changed by the change file:}
\let\*=\relax}
@* INDEX. The index is written by default into \.{INDEX.tex}, but that
name can be overridden with the style-file entry \.{index.tex}.
Here we begin the index:
\newbox\Sbox % Saved box preceding the index
\newbox\Lbox % Lefthand column in the index
% The following macro is the style file entry \.{index.preamble}.
\def\Winx{\par\vskip6pt plus 1fil
\write\cont{}% Ensure that the contents file isn't empty
\closeout\cont % The contents information has been fully gathered
\output{\ifpagesaved\normaloutput{\box\Sbox}\lheader\rheader\fi
\global\setbox\Sbox=\page \global\pagesavedtrue}
\pagesavedfalse \eject % Eject the page-so-far and predecessors
\setbox\Sbox\vbox{\unvbox\Sbox}% Take it out of its box
\vsize=\pageheight \advance\vsize by -\ht\Sbox % The remaining height
\hsize=.5\pagewidth \advance\hsize by -10pt
% Column width for the index (20pt between cols)
\parfillskip 0pt plus .6\hsize % Try to avoid almost empty lines
\def\lr{L}% This tells whether the left or right column is next
\output{\if L\lr\global\setbox\Lbox=\page \gdef\lr{R}
\else\normaloutput{\vbox to\pageheight{\box\Sbox\vss
\hbox to\pagewidth{\box\Lbox\hfil\page}}}\lheader\rheader
\global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi}
% \message{Index:}
\parskip 0pt plus .5pt
\outer\def\:##1, {\par\hangindent2em\noindent##1:\kern1em}% Index entry
\def\[##1]{$\underline{##1}$}% Underlined index item
\def\(##1){$^{\rm ##1}$}% Language marker
\let\Windexspace\medskip % Spacing between letter groups in index.
\rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
\hyphenpenalty 10000 \parindent0pt}
@ End the index. This macro is the style-file entry \.{index.postamble}.
\def\Wfin{\par\vfill\eject
\ifpagesaved\null\vfill\eject\fi % Output a null index column
\if L\lr\else\null\vfill\eject\fi % Finish the current page
\parfillskip 0pt plus 1fil
\def\rhead{NAMES OF THE SECTIONS}
\output{\normaloutput\page\lheader\rheader}
\setpage
\def\note##1##2.{\quad{\eightrm##1 ##2.}}
\def\WU{\note{Used in}}% Cross-reference for uses of sections
\def\:{\par\hangindent 2em}\let\*=*}
@ Begin the module list. Presently, this is just an unused hook for
special purposes; it is the style file entry \.{modules.preamble}.
\let\Wmods\relax
@* MISCELLANEOUS.
Miscellaneous run info:
\def\Winfo#1#2#3#4{\bigskip
\:{{\bf COMMAND LINE:}\ \ \Wtypewriter{#1}.}\smallskip
\:{{\bf WEB FILE:}\ \ \Wtypewriter{#2}.}\smallskip
\:{{\bf CHANGE FILE:}\ \ \Wtypewriter{#3}.}\medskip
\:{{\bf GLOBAL LANGUAGE:}\ \ \Wtypewriter{\rm #4}.}\medskip}
@ Finish the section names, do the table of contents and terminate:
\def\Wcon{\par\vfill\eject
\rightskip 0pt \hyphenpenalty 50 \tolerance 200
\setpage
\output{\normaloutput\page\lheader\rheader}
\titletrue % Prepare to output the table of contents
\pageno=\contentspageno \def\rhead{TABLE OF CONTENTS}
\topofcontents
\catcode`\@@=11
\hbox to\hsize{\hfil Section\hbox to3em{\hss Page}}
\def\WZ##1##2##3##4{\hbox to\hsize{\kern##1em\ignorespaces##2
\leaders\hbox to .5em{.\hfil}\hfil\ ##3\hbox to3em{\hss##4}}}
\let\WIM\WIN % Restore the proper definition.
\readcontents\relax % Read the contents info.
\botofcontents
\FWEBend}
@ Assign a symbolic name to a module. This scheme has no forward
referencing at present for plain \TeX, although this could easily be
extended. For \LaTeX, forward referencing works because the \.{aux}~file
is used.
% Label a section with an identifying name.
\def\modlabel#1{%
\ifLaTeXisloaded
\label{MOD#1}%
\else
\edef\next{\gdef\expandafter\noexpand\csname MOD#1\endcsname{\modno}}%
\next
\fi}
% Print the number of a labelled section.
\def\Wmodule#1{\ifLaTeXisloaded
\ref{MOD#1}%
\else
\csname MOD#1\endcsname
\fi}
% Examples of references to sections.
\def\WEBsection#1{section~\Wmodule{#1}}% |\section| is used by \LaTeX.
\def\WEBmodule#1{module~\Wmodule{#1}}
\let\module\WEBmodule% For backward compatibility.
@ Language commands are printed in the left margin, following Knuth's
solution in Appendix~A of the \TeX book. They are actually printed one
line down, because the language command is gobbled up before the line break
is emitted.
\def\strutdepth{\dp\strutbox}
\def\marginal#1{\strut\vadjust{\kern-\strutdepth\specialmargin{#1}}}
\def\specialmargin#1{\vtop to\strutdepth{
\baselineskip\strutdepth
\vss\llap{#1 }\null}}
\def\LANGUAGE#1{\marginal{\smash{\vtop{\hbox{%
\hbox{\tt@@L\lowercase{#1}:\enspace}}\null}}}\ignorespaces}
% Use the next one if you don't want language changes to be printed.
@#if 0
\def\LANGUAGE#1{\relax\ignorespaces}
@#endif
@ The |\begintt| and |\endtt| verbatim constructions, borrowed from \TeX.
\newskip\ttglue
\ttglue=0.5em plus 0.25em minus 0.15em
\def\ttother{\catcode`\\=\other \catcode`\{=\other \catcode`\}=\other
\catcode`\$=\other \catcode`\&=\other \catcode`\#=\other
\catcode`\%=\other \catcode`\~=\other \catcode`\_=\other
\catcode`\^=\other}
\def\ttverbatim{\begingroup \ttother \obeyspaces \obeylines \tt}
{\obeyspaces\gdef {\ }}
\def\begintt{$$\let\par=\endgraf
\ttverbatim
\parskip=0pt
% \catcode`\@@=0
\rightskip=-\parindent
\ttfinish}
\def\Begintt{\bgroup
\let\par=\endgraf
\ttverbatim
\parskip=0pt
\rightskip=-\parindent
\ttFinish}
{\catcode`\|=0
|catcode`|\=\other
|obeylines%
|gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}%
|gdef|ttFinish#1\Endtt{#1|endgroup|egroup}}
\let\verticalbar|
\def\activebar{\catcode`\|=\active}
{\activebar
\gdef\normalbar{\activebar
\let|\verticalbar}}
%\activebar
{\obeylines%
\gdef\ttbar{\activebar%
{\obeylines\gdef|{\ttverbatim%
\spaceskip=\ttglue%
\let^^M=\ \let|=\endgroup}}}}
\let\WCX\Begintt
@* INDEX.